﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPIExample.Adapters;
using WebAPIExample.Adapters.Data;
using WebAPIExample.Models;

namespace WebAPIExample.Controllers
{
    public class apiTodoController : ApiController
    {
        ITodoAdapter adapter;

        public apiTodoController()
        {
            adapter = new TodoDataAdapter();
        }
        public IHttpActionResult Get()
        {
            List<TodoViewModel> models = adapter.GetTodoViewModels();

            return Ok(models);
        }

        public IHttpActionResult Post(CreateTodoViewModel model)
        {
            adapter.CreateTodoItem(model);
            return Ok();
        }
    }
}
